package com.cmf.controller;

import com.cmf.common.Result;
import com.cmf.dto.CategoryDto;
import com.cmf.entity.Category;
import com.cmf.service.CategoryService;
import com.cmf.common.PageResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.web.HttpRequestHandler;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: cmf
 * @Date: 2025/8/25 23:12
 * @Version: v1.0.0
 * @Description: TODO
 **/
@RestController
@RequestMapping("/category")
@Slf4j
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    @PostMapping("/list")
    public Result<PageResult<Category>> pageInfo( HttpRequest httpRequest, @RequestBody() CategoryDto categoryDto){
        PageResult<Category> list = categoryService.pageInfo( categoryDto);
//        request.getHeaders().forEach((name, values) -> {
//            log.info("{}:{}", name, values);
//        });
        return Result.ok(list);
    }
}
